home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / BARNET / COMPILER / SATHER / !Sather / Library / Containrs / sa / list < prev    next >
Text File  |  1996-09-05  |  2KB  |  61 lines

  1. ---------------------------> Sather 1.1 source file <--------------------------
  2. -- list.sa: Extensible array
  3. -- Author: Benedict A. Gomes <gomes@samosa.ICSI.Berkeley.EDU>
  4. -- Copyright (C) 1995, International Computer Science Institute
  5. -- $Id: list.sa,v 1.7 1996/09/05 00:03:43 borisv Exp $
  6. --
  7. -- COPYRIGHT NOTICE: This code is provided WITHOUT ANY WARRANTY
  8. -- and is subject to the terms of the SATHER LIBRARY GENERAL PUBLIC
  9. -- LICENSE contained in the file: Sather/Doc/License of the
  10. -- Sather distribution. The license is also available from ICSI,
  11. -- 1947 Center St., Suite 600, Berkeley CA 94704, USA.
  12. -------------------------------------------------------------------
  13. abstract class $LIST{ETP} < $ARR{ETP}, $STR is
  14.    -- An extensible array abstraction. Similar to a list abstraction,
  15.    -- but keys are integers after an insert all other keys may have
  16.    -- changed
  17.    -- Inherits:
  18.    -- size: INT;
  19.    -- aget(i: INT): ETP 
  20.    -- aset(ind: INT, e: ETP) 
  21.    -- has_ind(i: INT): BOOL; 
  22.    -- elt!: ETP;
  23.    -- ind!: INT 
  24.    -- set_view: $RO_SET{ETP};
  25.  
  26.    --              ------ Initialization/Duplication ------
  27.    copy: SAME;
  28.    -- Redefined to narrow the return type
  29.  
  30.    --              ------ Insertion/Removal --------------- 
  31.    insert_after(ind: INT, val: ETP);
  32.    -- pre valid_ind(ind) post valid_ind(result);
  33.    -- Insert the value "val" after the index "ind" in the list
  34.    -- The indices of all subseqeuent elements will be shifted up by 1
  35.    
  36.    insert_before(ind: INT,val: ETP);
  37.    -- Insert the value "val" before the index "ind" in the list
  38.    -- The indices of all subsequent elements will be shifted upward
  39.  
  40.    insert_all_before(ind: INT, val: $CONTAINER{ETP});
  41.    -- Insert the elements of "val" in order, before "ind"
  42.    -- The indices of all subsequent elements will be shifted upward
  43.    
  44.    insert_all_after(ind: INT, val: $CONTAINER{ETP});
  45.    -- Insert the elements of the list in order after "ind"
  46.    -- The indices of all subsequent elements will be shifted upward
  47.  
  48.    
  49.    append(e: ETP);
  50.    -- Concatenate "e" onto the end of the array
  51.  
  52.    append_all(l: $CONTAINER{ETP});
  53.    -- post has(l.elt!) 
  54.    -- Append the elements of "l" onto the end of the current array
  55.  
  56.    equals(a: $RO_ARR{ETP}): BOOL;
  57.    
  58. end; -- class $LIST{ETP}
  59. --=============================================================================
  60.  
  61.